package com.lenovo.spider.component.pipeline;

import com.lenovo.spider.common.spi.ServiceProvider;
import com.lenovo.spider.component.TaskProcess.Pipeline;
import com.lenovo.spider.domain.Task;
import lombok.extern.slf4j.Slf4j;
import lombok.val;

/**
 * @author <a href="mailto:liuhan3@lenovo.com">HanL(liuhan3)</a>
 * on 2018/4/13 14:25
 */
@Slf4j
@ServiceProvider
public class ConsolePipeline implements Pipeline {
    @Override
    public boolean support(Task task) {
        return task.isSuccess();
    }

    @Override
    public Task handle(Task task) {
        val response = task.getResponse();
        log.info("任务处理完成，结果： {}", response);
        System.out.println(task.getItem());
        return task;
    }
}
